<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/vendor/bootstrap/css/bootstrap.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Custom Font Icons CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font.css">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/custom.css">
    <title>文章</title>
</head>
<body>
<%@include file="header.jsp"%>
<div class="d-flex align-items-stretch">
    <!-- Sidebar Navigation-->
   <%@include file="nav.jsp"%>
    <!-- Sidebar Navigation end-->
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">发布文章</h2>
            </div>
        </div>

        <section class="no-padding-bottom">

            <div class="list-group myList">
                <!--搜索文章的条件-->
                <div class="myTitle">
                    <form class="form-inline">
                        <div class="form-group">
                            <label for="inlineFormInput" class="sr-only">Name</label>
                            <input id="inlineFormInput" type="text" placeholder="按标题名字查找" class="mr-sm-3 form-control" name="aName">
                        </div>
                        <div class="form-group">
                            <input type="submit" value="查询" class="btn btn-primary">
                        </div>
                    </form>

                    <input id = "addArt" type="submit" value="发布文章" class="btn btn-primary">

                </div>

                <ul>
                    <c:forEach items="${articles.data}" var="a">
                        <li class="list-group-item">
                            <a href="${pageContext.request.contextPath}/user/articleDetail?id=${a.id}">${a.title}</a>
                            <p class="h6"><strong>作者：</strong>${a.publishRealName}</p>
                            <p class="h6"><strong>时间：</strong>${a.publishDate}</p>
                            <p style="white-space:nowrap;overflow:hidden;text-overflow: ellipsis">${a.content}${articles.totalPage}
                            </p>
                        </li>
                    </c:forEach>

                </ul>

                <nav class="text-center" aria-label="Page navigation">
                    <ul class="pagination">
                        <li>
                            <a href="${pageContext.request.contextPath}/user/showArticle?currentPage=${articles.currPage-1<1?1:articles.currPage-1}" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <c:forEach begin="1" end="${articles.totalPage}" var="at">
                            <li><a href="/user/showArticle?currentPage=${at}">${at}</a></li>
                        </c:forEach>
                        <li>
                            <a href="${pageContext.request.contextPath}/user/showArticle?currentPage=${articles.currPage+1>articles.totalPage?articles.totalPage:articles.currPage+1}" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
        </section>

        <%@include file="footer.jsp"%>

    </div>
</div>

<!-- JavaScript files-->
<%@include file="floor.jsp"%>

</body>
</html>